'use strict';
const db = uniCloud.database();
exports.main = async (event, context) => {
	//event为客户端上传的参数
	const collection = await db.collection('account').where({
		_id: event.accountId
		// _id: '642a44f0f5cf3a3e090bb046'
	}).get()
	// let a = collection.data[0].userIds.push(event.id)
	collection.data[0].userIds.push(event.userId)
	const collection2 = await db.collection('account').where({
		_id: '642a44f0f5cf3a3e090bb046'
		// _id: event.accountId
	}).update({
		userIds: collection.data[0].userIds
	})
	//返回数据给客户端

	return {
		code: 200,
		msg: '加入成功',
	}
};
